<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    var userList = ["zhangsan","lisi","wangwu","zhaoliu"];
    //删除操作
    //arr.shift删除数组的第一个元素，数组长度会减1，返回值为被删除的数据元素
    
    while(userList.length>0){
        var result = userList.shift();
        console.log(userList);
    }
    

    //arr.pop删除数组的最后一个元素
    var userList1 = ["zhangsan","lisi","wangwu","zhaoliu"];
    var result1 = userList1.pop();
    console.log(result1);
</script>
</html>